<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
   <%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>增加一个课程</title>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<h3>${reason}</h3>
<s:form name="f1" action="class_add" method="post" enctype="multipart/form-data"
		onsubmit="return check()">
		<tr><td>课程名称:</td><td><input type="text" name="name">
		<font color="red">*</font></td></tr>
		<tr><td>房间号码:</td><td><input type="text" name="classroomId">
		<font color="red">*</font></td></tr>
		<tr><td>开始时间:</td><td><input type="date" name="beginTime">
		<font color="red">*</font></td></tr>
		<tr><td>结束时间:</td><td><input type="date" name="endTime">
		<font color="red">*</font></td></tr>
		<tr><td>地址:</td><td><textarea cols="20" rows="3" name="place"></textarea>
		<font color="red">*</font></td></tr>
		<tr><td>最大人数:</td><td><input type="text" name="clientNumMax">
		<font color="red">*</font></td></tr>
		<tr><td>价格:</td><td><input type="text" name="priceEveryone">
		<font color="red">*</font></td></tr>
		<tr><td>其他信息:</td><td><textarea cols="20" rows="10" name="detail"></textarea>
		<font color="red">*</font></td></tr>
		<tr><td><input type="submit" value="提交" class="btn btn-info"/></td>
		<td><input type="reset" value="重置" class="btn btn-info"/></td></tr>
	</s:form>

<script type="text/javascript">
		function check(){
		var name = document.f1.name;
		var classroomId = document.f1.classroomId;
		var place = document.f1.place;
		var detail = document.f1.detail;
		var clientNumMax = document.f1.clientNumMax;
		var priceEveryone = document.f1.priceEveryone;
		var beginTime = document.f1.beginTime;
		var endTime = document.f1.endTime;
		var reNum =/^[0-9]+$/;
		if(name.value==""||classroomId.value==""||place.value==""||detail.value==""||clientNumMax.value==""
		||priceEveryone.value==""||beginTime.value==""||endTime.value==""){
			alert("必填项不能为空！");
			return false;
		}
		if(!reNum.test(clientNumMax.value) || !reNum.test(priceEveryone.value)
		|| !reNum.test(classroomId.value) ){
			alert("“房间号码、价格和最大人数必须为数字！");
			return false;
		}
		
		else{
			return true;
		}
	}
    </script>
</body>
</html>